<template>
    <div>
<!--		<el-button @click="drawer = true" type="primary" icon="el-icon-edit" style="position: absolute;left: 0;top: 300px;;"circle>-->
<!--        </el-button>-->
<!--        <div class="button-group mt&#45;&#45;20" @click="drawer = true"  style="position: absolute;left: 0;top: 300px;z-index: 9">-->
<!--            <Button title="图片库"/>-->
<!--        </div>-->

        <el-drawer
                title="我的图片库"
                :visible.sync="drawer"
                :direction="direction"
                :before-close="handleClose"
                size="35%">
            <PhotoUploader @doSubmit="drawer=false"/>
        </el-drawer>
    </div>
</template>

<script>
    import PhotoUploader from "../function/PhotoUploader";
    import eventBus from "../../global/eventBus";
	import Button from "../elements/button/Button.vue";
	// import Icon from "../icon/Icon";
    export default {
        name: "MyDrawer",
        components: {PhotoUploader,Button},
        data(){
            return{
                btnTitle:false,
                drawer: false,
                direction: 'ltr'
            }
        },
        created() {
            var that = this
            eventBus.$on('callDrawer',data=>{
                if(this.$ls.get('userInfo')===null){
                    this.$modal.show('login-modal');
                }else {
                    that.lockScroll()
                    that.drawer = data
                }
            })
        },
        methods:{
            handleClose(done) {
                this.unlockScroll()
                done()
                // this.$confirm('确认关闭？')
                //     .then(_ => {
                //         done();
                //     })
                //     .catch(_ => {});
            },
            lockScroll() {
                document.documentElement.style.overflowY = 'hidden'
            },
            unlockScroll() {
                document.documentElement.style.overflowY = 'auto'
            }
        }
    }
</script>

<style scoped>

</style>